<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// $Id: TagLibForm.class.php 2730 2016-9-8 04:45:34Z liu21st $

/**
 +-------------------------------
 * Html标签库驱动
 +-------------------------------
 */
class TagLibForm extends TagLib{
    // 标签定义
    protected $tags   =  array(
        // 标签定义： attr 属性列表 close 是否闭合（0 或者1 默认1） alias 标签别名 level 嵌套层次
        'text'        => array('attr'=>'name,value,hiddenname,hiddenvalue,onClick,placeholder','close'=>0)
        );
		
    /**
     +----------------------------------------------------------
     * TEXT标签解析
     * 格式： <html:text value="value" />
     +----------------------------------------------------------
     * @access public
     +----------------------------------------------------------
     * @param string $attr 标签属性
     +----------------------------------------------------------
     * @return string|void
     +----------------------------------------------------------
     */
    public function _text($attr) {
        $tag        = $this->parseXmlAttr($attr,'text');
        $name       = isset($tag['name'])?$tag['name']:'';
		$value		= isset($tag['value'])?$tag['value']:'';
		$hiddenname = $tag['hiddenname'];
		$hiddenvalue= $tag['hiddenvalue'];
		$onClick    = $tag['onclick'];
		$placeholder= $tag['placeholder'];
        $parseStr='<div class="input-group"><input readonly value="'.$value.'" name="'.$name.'" class="form-control f-fill'.$hiddenname.'" type="text" placeholder="'.$placeholder.'"><input name="'.$hiddenname.'" class="form-control" value="'.$hiddenvalue.'" type="hidden" ><span class="input-group-btn"><button class="btn btn-default" onClick="'.$onClick.'" type="button">选择</button></span></div>';
        return $parseStr;
    }
}
?>